package com.freedom.controller.w.core;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletResponse;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import com.freedom.bean.core.SysCity;
import com.freedom.service.core.SysCityService;
import com.freedom.util.sys.HtmlUtil;
import com.freedom.vo.w.core.WebVo;

/**
 * 市
 * @author huguangjun
 *
 */
@Controller
public class SysCityController extends BaseWebPaginationCRUDController<WebVo> {
	private static final Logger logger = LoggerFactory.getLogger(SysCityController.class);
	@Autowired
	private SysCityService sysCityService;

	@Override
	public String init() {
		// TODO Auto-generated method stub
		return null;
	}

	@RequestMapping("wh005/1")
	public void getSysCityByProvinceId(@RequestParam String provinceId, HttpServletResponse response) {
		Map<String, Object> map = new HashMap<String, Object>();
		List<SysCity> sysCitys = null;
		try {
			map.put("provinceId", provinceId);
			sysCitys = this.sysCityService.getSysCityByProvinceId(map);
		} catch (Exception e) {
			logger.error(e.toString());
		}
		HtmlUtil.writerJson(response, sysCitys);
	}
}
